package showtime.framework.algorithm.bts
{
	

	public class BehaviourNode
	{
		public var isExecuting:Boolean = false;
		
		public var parentNode:CompositeNode = null;
		
		private static var _currentActionNode:LeafNode = null;

		public function BehaviourNode()
		{
			
		}
		
		public function execute():void
		{
			isExecuting = true;
		}
		
		public function returnResultToParent(value:Boolean):void
		{
			if (parentNode != null)
			{
				parentNode.childResult = value;
			}
			
			isExecuting = false;
		}
		
		public function stop():void
		{
			isExecuting = false;
		}
		
		public static function set currentActionNode(node:ActionNode):void
		{
			if (node == _currentActionNode)
			{
				return;
			}
			
			if (_currentActionNode != null)
			{
				_currentActionNode.stop();
			}
			
			_currentActionNode = node;
		}
	}
}